package com.yingxin.yxerp.module.activiti.biz.controller.update;

import com.yingxin.yxerp.module.common.FinishBusinessType;
import com.yingxin.yxerp.module.common.InvalidBusinessType;
import com.yingxin.yxerp.module.common.UpdateBusinessType;
import com.yingxin.yxerp.module.common.ValueLabel;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * 获取编辑，作废，完结 业务类型
 */

@RestController
@RequestMapping("/apply/condition/businessType")
public class ApplyTypeController {

    @ApiOperation(value = "获取修改条件类型")
    @GetMapping("/update")
    public List<ValueLabel> getUpdateBusinessType() {
        List<ValueLabel> list = new ArrayList<>();
        for (UpdateBusinessType i : UpdateBusinessType.values()) {
            ValueLabel value = new ValueLabel();
            value.setValue(i.getType());
            value.setLabel(i.getTypeName());
            list.add(value);
        }
        return list;
    }

    @ApiOperation(value = "获取作废条件类型")
    @GetMapping("/invalid")
    public List<ValueLabel> getInvalidBusinessType() {
        List<ValueLabel> list = new ArrayList<>();
        for (InvalidBusinessType i : InvalidBusinessType.values()) {
            ValueLabel value = new ValueLabel();
            value.setValue(i.getType());
            value.setLabel(i.getTypeName());
            list.add(value);
        }
        return list;
    }

    @ApiOperation(value = "获取完结条件类型")
    @GetMapping("/finish")
    public List<ValueLabel> getFinishBusinessType() {
        List<ValueLabel> list = new ArrayList<>();
        for (FinishBusinessType i : FinishBusinessType.values()) {
            ValueLabel value = new ValueLabel();
            value.setValue(i.getType());
            value.setLabel(i.getTypeName());
            list.add(value);
        }
        return list;
    }

}
